package com.lagou.demo.service;

import com.lagou.demo.dao.ArticleRepository;
import com.lagou.demo.pojo.Articel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;


/**
 * @author dcwu5
 * @date 2020-06-27
 * @description
 */
@Service
public class ArticleService {

    @Autowired
    private ArticleRepository articleRepository;

    public Page<Articel> getArticle(int pageNum, int pageSize) {
        Pageable pageable = PageRequest.of(pageNum, pageSize);
        Page<Articel> page = articleRepository.findAll(pageable);
        return page;
    }

}
